var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2AudioManager = require("AudioManager");
var $2DataManager = require("DataManager");
var $2ZombieMgr = require("ZombieMgr");
var $2SceneStage = require("SceneStage");
var $2KDefine = require("KDefine");
var $2PlantBase = require("PlantBase");
var d = cc._decorator.ccclass;
var def_Plant23 = /* */function (_c$default2) {
  babel_inherits(h, _c$default2);
  var _super64 = babel_createSuper(h);
  function h() {
    var _this139;
    babel_classCallCheck(this, h);
    _this139 = _super64.apply(this, arguments);
    _this139.ready = false;
    return _this139;
  }
  babel_createClass(h, [{
    key: "stateWait",
    value: function stateWait(e) {
      var _this140 = this;
      if (this.state === $2KDefine.State.wait) {
        this.state = $2KDefine.State.waiting;
        this.dragon.setAnimation(0, "2zaizhong", false);
        this.scheduleOnce(function () {
          _this140.ready = true;
          _this140.dragon.setAnimation(0, "4maochu", false);
          _this140.dragon.setCompleteListener(function () {
            $2AudioManager.default.instance.playEffect(_this140.shootSound, _this140.shootSoundVolume);
            _this140.dragon.setCompleteListener(null);
            _this140.dragon.setAnimation(0, "daiji", true);
          });
        }, this.damage);
      }
    }
  }, {
    key: "stateHurt",
    value: function stateHurt(e) {
      if (this.state == $2KDefine.State.hurt) {
        this.state = $2KDefine.State.hurting;
        this.dragon.setAnimation(0, "shouji", true);
      }
    }
  }, {
    key: "onCollisionStay",
    value: function onCollisionStay(e, t) {
      var _this141 = this;
      if (this.ready) {
        this.node.getComponent(cc.BoxCollider).enabled = false;
        this.ready = false;
        var _e69 = $2ZombieMgr.default.instance().zombieInRow[this.row].values();
        var _t40 = _e69.next();
        for (; !_t40.done;) {
          var _a26 = _t40.value;
          _a26.hp > 0 && _a26.node.x - this.node.x < $2DataManager.default.instance.blockWidth * this.attDistance && _a26.bomb();
          _t40 = _e69.next();
        }
        $2AudioManager.default.instance.playEffect(this.hitSound, this.hitSoundVolume);
        this.dragon.setAnimation(0, "8baozha", false);
        this.dragon.setCompleteListener(function () {
          _this141.dragon.setCompleteListener(null);
          $2SceneStage.default.instance.delPlantInBlckArr(_this141.row, _this141.col);
          _this141.node.destroy();
        });
      }
    }
  }, {
    key: "stateDead",
    value: function stateDead(e) {
      var _this142 = this;
      if (this.state === $2KDefine.State.dead) {
        this.state = $2KDefine.State.deading;
        this.node.getChildByName("Effect").active = true;
        cc.tween(this.node.getChildByName("p01")).to(.5, {
          opacity: 0
        }).start();
        this.node.getChildByName("Effect").getComponent(sp.Skeleton).setAnimation(0, "newAnimation", false);
        this.node.getChildByName("Effect").getComponent(sp.Skeleton).setCompleteListener(function () {
          _this142.node.destroy();
        });
        $2SceneStage.default.instance.delPlantInBlckArr(this.row, this.col);
      }
    }
  }, {
    key: "checkTarget",
    value: function checkTarget() {
      return false;
    }
  }]);
  return h;
}($2PlantBase.default);
def_Plant23 = cc__decorate([d], def_Plant23);
exports.default = def_Plant23;